Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The whole options module should be inline #14417

Merged
merged 3 commits into from
May 21, 2020
Merged

The whole options module should be inline #14417

merged 3 commits into from
May 21, 2020

Conversation

mratsim
Copy link
Collaborator

@mratsim mratsim commented May 21, 2020

none shows up as a bottleneck in benchmark :/

I'm not going to turn this into another blog post like #9514 but this takes 45s to raytrace in C++ and the Nim code is almost equivalent besides choosing to use Option return values.

For example the none function in the benchmark below

image

Ideally this is a small enough change to be backported in 1.2.2 because we do use Option in Nimbus.

Furthermore the values are quite huge to wrap/unwrap (256-bit hash) so inline should help significantly.

@Araq
Copy link
Member

Araq commented May 21, 2020

I prefer explict {.inline.} on the procs you need to be inline. Also, lent annotations might help.

@mratsim
Copy link
Collaborator Author

mratsim commented May 21, 2020

lent doesn't seem to work at compile-time.

The tests have a lot of

../../lib/pure/options.nim(171, 3) Error: limited VM support for 'addr'

@Araq Araq merged commit f71f8b0 into nim-lang:devel May 21, 2020
narimiran pushed a commit that referenced this pull request Jun 1, 2020
* The whole options module should be inline

* Use inline per proc and tag `lent` where appropriate

* Remove lent annotation (failing at compiletime)

(cherry picked from commit f71f8b0)
EchoPouet pushed a commit to EchoPouet/Nim that referenced this pull request Jun 13, 2020
…1.2]

* The whole options module should be inline

* Use inline per proc and tag `lent` where appropriate

* Remove lent annotation (failing at compiletime)
@arnetheduck
Copy link
Contributor

@mratsim did you try to simply add -flto to the compiler flags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants